﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace _7zDll
{
    public class Class1
    {
        public void Compress(string source, string target)
        {
            ProcessStartInfo p = new ProcessStartInfo();
            p.FileName = @"7za.exe";
            p.Arguments = "a -t7z \"" + target + "\" \"" + source + "\" -mx=9";
            //               1              2                       3               4
            p.WindowStyle = ProcessWindowStyle.Normal;
            Process x = Process.Start(p);
            x.WaitForExit();
        }

        public void ExtractFile(string source, string dest)
        {
            string zPath = @"7za.exe";
            ProcessStartInfo pro = new ProcessStartInfo();
            pro.WindowStyle = ProcessWindowStyle.Hidden;
            pro.FileName = zPath;
            pro.Arguments = "x \"" + source + "\" -o" + dest;
            Process x = Process.Start(pro);
            x.WaitForExit();
        }
    }
}
